class FILTERGRAPH_DIGRAPH_VIEW{NTP,GTP<$RO_DIGRAPH{NTP}} < $RO_DIGRAPH{NTP}
****
View a graph through a node/edge filter predicate Only the nodes and edges that satisfy the predicates are visible as nodes and edges in this view. If the node predicate is "np" and the edge predicate is "ep", Nodes which satisfy "np" are in the graph Edges which satisfy "ep" and whose nodes are both satisfied by "np" are in the graph.


Ancestors
$RO_DIGRAPH{_} $GRAPH{_,_} $STR $ELT{_}
$ELT RO_DIGRAPH_INCL{_}

Descendants
FILTERGRAPH_DIGRAPH_VIEW{_}



Public


Features
copy: $DIGRAPH{NTP} .. Included as copy
create(m:GTP,np:ROUT{NTP}:BOOL): SAME
**** Create a subgraph of "m", which includes all nodes that pass the node filter "np"
create(m:GTP,np:ROUT{NTP}:BOOL,ep:ROUT{DIEDGE{NTP}}:BOOL): SAME
**** Create a subgraph of "m". It consists of nodes that pass the node filter "np" and edges that pass the edge filter, whose ends pass the node filter. Nodes n that belong to "m" and np.call(n) = true Edges e (1) m.has_edge(e)
_________(2)_np.call(e.first)_and_np.call(e.second)
_________(3)_ep.call(e)
equals(g: $RO_DIGRAPH{NTP}):BOOL .. Included as equals
**** True if both have the same set of nodes and edges
has(n: NTP): BOOL .. Included as has
has_edge(e: DIEDGE{NTP}): BOOL
**** An edge exists here if and only if it exists in the source, both its end points pass the node filter and the edge itself passes the edge filter
has_node(n: NTP): BOOL
is_empty: BOOL .. Included as is_empty
n_adjacent(n:NTP): INT .. Included as n_adjacent
n_edges: INT
n_incoming(n: NTP): INT
**** Compute the number of edges by actually iterating over the edges and returning the resulting number found
n_nodes: INT
n_outgoing(n: NTP): INT
**** Compute the number of outgoing edges by actually iterating over them
size: INT .. Included as size
str: STR .. Included as str
**** Print out the graph using the bound routine "f" for the nodes

Iters
adjacent!(once n: NTP): NTP .. Included as adjacent!
**** Adjacent is aliased to "outgoing"
edge!: DIEDGE{NTP}
elt!: NTP .. Included as elt!
**** Returns the nodes of the graph
incoming!(once n: NTP): NTP
node!: NTP
**** Yield all the nodes in the source that pass the filter node predicate
outgoing!(once n: NTP): NTP
**** Yield all the outgoing nodes from node "n". Yield only nodes which pass the filter and are connected by an edge that passes the filter


Private

attr ep: ROUT{DIEDGE{NTP}}: BOOL;
attr ep: ROUT{DIEDGE{NTP}}: BOOL;
node_str(n: NTP): STR .. Included as node_str
**** There should not be void nodes in the graph!
attr np: ROUT{NTP}: BOOL;
attr np: ROUT{NTP}: BOOL;
attr source:GTP;
attr source:GTP;

The Sather Home Page